UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8lAqi6+t3+CiS20xjXIcBWvNH4TYFP+YVVa85S/7K8c='
WHERE
key_id = 'c97d5d0b9e0e05644a28a0529c45683409c1875ae2e5a5e01153e7073a52f474'
AND (
token = '8lAqi6+t3+CiS20xjXIcBWvNH4TYFP+YVVa85S/7K8c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)