UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'S61dBWxv19qjzaGRPKtVC1CUBKRq2xzYOgGdvVl9F20='
WHERE
key_id = '66c1ba7b29a852014ea0e1bb35e97a8c30303f4bb2206f5424f240fa82ddb2a3'
AND (
token = 'S61dBWxv19qjzaGRPKtVC1CUBKRq2xzYOgGdvVl9F20='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)