UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YxcGCpf62hYoPaiuYq1fPgt2Jh134bp3aKpMnawlI+c=' 
WHERE 
  key_id = '85b782b06588ea56f59781f565da5f6ebdeb27eda79ef037b6093d17cace4880' 
  AND (
    token = 'YxcGCpf62hYoPaiuYq1fPgt2Jh134bp3aKpMnawlI+c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036