UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yucf4hXlOqjMtPW2nk+kptHjf4YV7GAkuPDij6Ot1aY=' 
WHERE 
  key_id = 'a042d3b4f5205f86ae1f547dcc9164d94026da23cae2af24eba6094363f060f6' 
  AND (
    token = 'yucf4hXlOqjMtPW2nk+kptHjf4YV7GAkuPDij6Ot1aY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043