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