UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'osjv11KmlO/fJ40opAAYI/G8ieLLekwJZq3jtIYtpMc=' 
WHERE 
  key_id = 'b6fac9e27f06fbb5d4580056ba99cb9acf3393bc1894494ea4dda0140edea509' 
  AND (
    token = 'osjv11KmlO/fJ40opAAYI/G8ieLLekwJZq3jtIYtpMc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039