UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'POYzTImKl0wjexXZ9rzSO+3c0K4tuNhibAIADdPAqvE=' 
WHERE 
  key_id = '6b9b3edc7f436d48865a3360d1d9cdd6662c3675362322a955312d810370e4f8' 
  AND (
    token = 'POYzTImKl0wjexXZ9rzSO+3c0K4tuNhibAIADdPAqvE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021