UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xMpK0nEujD/CSGBOCDOZG9wHhJK8TnENm/Us2/8zvLo='
WHERE
key_id = 'ac639b4946b77a52a0b82f8397f2069e4f4cde5b347866e092af957510912fd2'
AND (
token = 'xMpK0nEujD/CSGBOCDOZG9wHhJK8TnENm/Us2/8zvLo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)