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