UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'StNJpGOOqoxlZN8d2jsgay/BWY5TyD0VOBKgT4qxb3U='
WHERE
key_id = 'fb4fac8e70b1c54cb3822dff39cbe8d5bbeb963c71254c21a9c46b6ee805496c'
AND (
token = 'StNJpGOOqoxlZN8d2jsgay/BWY5TyD0VOBKgT4qxb3U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)