UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'j6kckNPmSRGXMSr48kCfZDdWsNtpDoepqnUvz+kUeHQ='
WHERE
key_id = '1b77a925bbb5ab9abd18f586c0a1b8d944731aa53ddcc487e9174407ecd8000f'
AND (
token = 'j6kckNPmSRGXMSr48kCfZDdWsNtpDoepqnUvz+kUeHQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)