UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1bBC8S3bH2ECDCkS0g+w9rvxaD4tDaHF0tb7rYd/pt4='
WHERE
key_id = 'b9da216b7f9892930e76f0e95b47e5e6f5404c06036e863e16bee1b2e65aca6d'
AND (
token = '1bBC8S3bH2ECDCkS0g+w9rvxaD4tDaHF0tb7rYd/pt4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)