UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nT3wDk5k4F8KpxrBgD8/0lmd60XPN7EtKXv8NFfFYLU='
WHERE
key_id = 'ca9a3e882f3704c500f0acb9c05861c4ddbd6be0599c7c9194745bb93bb9c1e8'
AND (
token = 'nT3wDk5k4F8KpxrBgD8/0lmd60XPN7EtKXv8NFfFYLU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)