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