UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZVUjVv0XRGypiemn+r3T3HJOMJoPaJp5hjjVku2P5Dg='
WHERE
key_id = 'a7a3a53b52db3bcb640ad0ec632e2988baabc191e7bc1be63019a99557021643'
AND (
token = 'ZVUjVv0XRGypiemn+r3T3HJOMJoPaJp5hjjVku2P5Dg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)