UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DFPa51lCjpUUDyqRsnj7INN2biBbqfoc+WGopibDnQM=' 
WHERE 
  key_id = '7f54f8f095d7b0abc2918b23077382a205146c46c2a51fea84e25583a827280c' 
  AND (
    token = 'DFPa51lCjpUUDyqRsnj7INN2biBbqfoc+WGopibDnQM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042