UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'HH/fqSJhj2oV2R9kqwvdw09T6Gj7igSzLnWVK8OkOO4='
WHERE
key_id = '8e8c59f18c1661b8bf7782b4458519f4ee2e8984f90a2f585c51e9255f633f02'
AND (
token = 'HH/fqSJhj2oV2R9kqwvdw09T6Gj7igSzLnWVK8OkOO4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)