UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tQ0Q+j29A2gQ5V64NwYtpSTE6+3cN+252+R+Sp+k2G4='
WHERE
key_id = '642dcfc2dbd5ec7c8106624592d2ac9d35ddf40757c942c131d3562e2ff02165'
AND (
token = 'tQ0Q+j29A2gQ5V64NwYtpSTE6+3cN+252+R+Sp+k2G4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)