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