UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SR6VdykKvirURDGlh3QhNhRmGJrrp2RItFjlSsapf8Q=' 
WHERE 
  key_id = 'd9b2e7e2579d5974ee36f9b6822da6172235b321ae659349d780a29c96dc8aba' 
  AND (
    token = 'SR6VdykKvirURDGlh3QhNhRmGJrrp2RItFjlSsapf8Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00058