UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'W579J1aSlJLQ6E+WSeYKeXxjt4QE2ssmGQjVt7AyMFE='
WHERE
key_id = 'c8af84613de23db5d8380735dbf0a538f27ec3768e4f1d7e9a5690af2c322e3e'
AND (
token = 'W579J1aSlJLQ6E+WSeYKeXxjt4QE2ssmGQjVt7AyMFE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)