UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sj8r7UfiFLGz6YC6qtpRfLIX0peIOCNmhrySd9qWV5I='
WHERE
key_id = '417a37b591019035e46ed707ea9db9ce783a8727a8a4c2893f3a3b499db66161'
AND (
token = 'sj8r7UfiFLGz6YC6qtpRfLIX0peIOCNmhrySd9qWV5I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)