UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'oLoFTTvP42MpgoG5s4oH6iV42CXFgZrCaZfZVRHEV4k='
WHERE
key_id = '39e623ac4169deb6e50dac1a3ff04032f1297303e48e5dd4a76fcf0fc8a54908'
AND (
token = 'oLoFTTvP42MpgoG5s4oH6iV42CXFgZrCaZfZVRHEV4k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)