UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wWQBKF2KZti6MipQJWsN8krBx6spFE62J4eb6C0J5Y8=' 
WHERE 
  key_id = '0eeb12b1f3c64efcb2974d55eda3ec026c645f22c7058dbcca164922d516882a' 
  AND (
    token = 'wWQBKF2KZti6MipQJWsN8krBx6spFE62J4eb6C0J5Y8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035