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

Query time 0.00038