UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XGlGKIMX6nEtfL/HupZT1dri4Xi384hEr5+5/7R8yzY='
WHERE
key_id = 'dec5a05906e17e4be5536ee7e451312f80c218b6beaa9d9dd1190ee975a254c4'
AND (
token = 'XGlGKIMX6nEtfL/HupZT1dri4Xi384hEr5+5/7R8yzY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)