UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NUsIPpizA/++6thAidILNLWdTukcYgoWPKYVjkzyK60=' 
WHERE 
  key_id = 'f33b670d373c42957327c5a761f838e46e7b547d24ed925e2eb0912e3266e446' 
  AND (
    token = 'NUsIPpizA/++6thAidILNLWdTukcYgoWPKYVjkzyK60=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031