UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gr8TQEpGx15wlGi8aQ24AR0FDUL+N+WNyC+XimuqaiY=' 
WHERE 
  key_id = 'e5b30438cc7e2ea6e4760e0c001f82366a1f626c758125864cddbc0c04121728' 
  AND (
    token = 'gr8TQEpGx15wlGi8aQ24AR0FDUL+N+WNyC+XimuqaiY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042