UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'UsRCziRKRZdfByZhT9GHW6mBpHFZSa0imZFKpTRHzKM='
WHERE
key_id = '21b4042c19bb9f2a14918e3496adb50effdf4d90a7c5955f337ba5c3c6165667'
AND (
token = 'UsRCziRKRZdfByZhT9GHW6mBpHFZSa0imZFKpTRHzKM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)