UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'WbSEw5bw19lSgO/+gdK9v3HPJrjMhE8ikUv9jfonzr8='
WHERE
key_id = 'e5a7f3b3f0c53a41be3eaf8bfb57c1c86cc476276a9b97cec952acbc1d400ad2'
AND (
token = 'WbSEw5bw19lSgO/+gdK9v3HPJrjMhE8ikUv9jfonzr8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)