UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '2JLGVmBA49dHBss4uE5nF4UMVFuIGXWJpiJZIURAo2c='
WHERE
key_id = 'b387861363234123acb0c5fd6fdfb17a2e3b81c4794c8f945ad23b2a4ce49e93'
AND (
token = '2JLGVmBA49dHBss4uE5nF4UMVFuIGXWJpiJZIURAo2c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)