UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aDKO/2ia2b7S0CYqJ89Y4UgQl6rx5ika2HE9dJTr3Cc=' 
WHERE 
  key_id = '80015af061fbee6aa62dc2e225bd12fda9c4c6d3178e83b7348385f2a4cd259d' 
  AND (
    token = 'aDKO/2ia2b7S0CYqJ89Y4UgQl6rx5ika2HE9dJTr3Cc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023