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

Query time 0.00033