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

Query time 0.00035