UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'HuPcwkJfIucLg8NJtLGARDm5eK430EDeQ8IpYMzdSbI='
WHERE
key_id = 'c7e77c149b3283208bae080689d6460651f60b1450e82d80a4f62fbe6bec88d4'
AND (
token = 'HuPcwkJfIucLg8NJtLGARDm5eK430EDeQ8IpYMzdSbI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)