UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Z2EIv1gfJ200hQ0qN+etkErvcrWG5g5z7lHaU0NDCcA='
WHERE
key_id = '3ed1af761c5021b6e19728281fbf5ac3a0432a94aa16be193c91321835bcf21e'
AND (
token = 'Z2EIv1gfJ200hQ0qN+etkErvcrWG5g5z7lHaU0NDCcA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)