UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Dhyq/VzhPGvfYTfbjraWGNztmUIe79H6kDEbF+EnpMU=' 
WHERE 
  key_id = '2dc39da58892d54a680572757e75b4edbd447dcf21f45dc74297c420b831eff3' 
  AND (
    token = 'Dhyq/VzhPGvfYTfbjraWGNztmUIe79H6kDEbF+EnpMU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021