UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'p8tV+75inFAm0sSYyei7lIL073mHfJ+tVGcSadClha0=' 
WHERE 
  key_id = '1a783cca28d48e644b2023f5090fd78a93197a23a8953eaa24b1aab4d670b03a' 
  AND (
    token = 'p8tV+75inFAm0sSYyei7lIL073mHfJ+tVGcSadClha0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028